package other.up.monitor;


import java.util.HashMap;
import java.util.Map;

/**
 * @author bingo
 * @Description
 * @Date 2018/8/7
 */
public class BrokenVisualizer {

    private LineFrame lineFrame ;

    private Map<Integer ,Integer> dataMap;

    public BrokenVisualizer() {
     lineFrame = new LineFrame("折线图",Const.horizontalLength+100,Const.verticalLength+100);
     dataMap = new HashMap<>();
     setDefaultValue();
     lineFrame.render(dataMap);
     new Thread(new Runnable() {
         @Override
         public void run() {
             while (true){
                 AlgoHelpler.pause(50);
              int month =    new Integer((int)(Math.random() * (12 - 0 + 1) + 0));
              int value =    new Integer((int)(Math.random() * (800 - 0 + 1) + 0));
              dataMap.put(month,value);
              lineFrame.render(dataMap);

             }
         }
     }).start();

    }

    public void  setDefaultValue(){

        dataMap.put(1,200);
        dataMap.put(2,200);

        dataMap.put(3,200);
        dataMap.put(4,200);

        dataMap.put(5,200);
        dataMap.put(6,200);

        dataMap.put(7,200);
        dataMap.put(8,200);

        dataMap.put(9,200);
        dataMap.put(10,200);

        dataMap.put(11,200);
        dataMap.put(12,200);

    }

    public static void main(String[] args) {
        BrokenVisualizer brokenVisualizer = new BrokenVisualizer();
    }

}
